//
// Created by ttao on 2022/7/21.
//

#ifndef COMPUTER_UTIL_H
#define COMPUTER_UTIL_H

#define BOOL    int
#define FALSE   0
#define TRUE    1

#include <math.h>
#include <malloc.h>
#include "hash.h"
#include "tree.h"
#include "container.h"

#define ISNULL(node) (!node || node == NULL)
#define ISNOTNULL(node) (!ISNULL(node))

#define isequare(s1, s2) ((ISNOTNULL(s1) && ISNOTNULL(s2)) && ((hashcmp(s1, s2) == 0) || s1 == s2)) ? TRUE:FALSE

int hashcmp(const char *s1, const char *s2);
char *strcpyautolen(char* s1, char *s2);


void getBase64(char * dest);                //获取64位随机数
void getRandomHex(char *dest, size_t len);
void getMd5(char *dest, const char * src);
void getSha1(char *dest, const char  *src);
void getSha256(char *dest, const char  *src);

BOOL verificationrbtree(Leader *leader);            // 红黑树的验证
#endif //COMPUTER_UTIL_H
